﻿Namespace B1Data
    ''' <summary>
    ''' 单元格赋值后的业务逻辑处理
    ''' 如：更新了数量字段，重新算价格。
    ''' </summary>
    ''' <remarks></remarks>
    Public MustInherit Class CellBusinessLogic
        Implements B1Data.ICellBusinessLogic
        Private col As B1Data.B1DataColumn
        Private _Error As String
        Private _rollback As Boolean

        ''' <summary>
        ''' New
        ''' </summary>
        ''' <param name="Column"> 更新字段列</param>
        ''' <remarks></remarks>
        Sub New(ByVal Column As B1Data.B1DataColumn)
            col = Column
        End Sub

        ''' <summary>
        ''' 如果计算失败，是否回滚更新操作字段
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public Property Rollback As Boolean
            Get
                Return _rollback
            End Get
            Set(ByVal value As Boolean)
                _rollback = value
            End Set
        End Property

        ''' <summary>
        ''' 执行业务逻辑
        ''' 必须重载
        ''' </summary>
        ''' <param name="row"></param>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public MustOverride Function DoLogic(ByVal row As B1Data.B1DataRow) As Boolean
      
        ''' <summary>
        ''' 错误提示
        ''' 需在DoLogic中赋值
        ''' </summary>
        ''' <value></value>
        ''' <returns></returns>
        ''' <remarks></remarks>
        Public ReadOnly Property [Error] As String
            Get
                Return _Error
            End Get
        End Property
    End Class
End Namespace

